Skip to content

fix: support large audio files (>25 MB) for transcription#37

Merged
shaulams merged 1 commit into
shaulams:mainfrom
yoimahacker:fix/large-file-upload
Apr 11, 2026
Merged

fix: support large audio files (>25 MB) for transcription#37
shaulams merged 1 commit into
shaulams:mainfrom
yoimahacker:fix/large-file-upload

Conversation

@yoimahacker
Copy link
Copy Markdown

Problem

Uploading audio files larger than 25 MB failed with a 413 error. The app never set `MAX_CONTENT_LENGTH`, so Flask/Werkzeug silently enforced a 25 MB upload limit — making the existing compression logic unreachable dead code.

Changes

1. Set MAX_CONTENT_LENGTH to 2 GB
Covers ~120 min WAV recordings at broadcast quality (the stated use case).

2. Dynamic compression bitrate
The hardcoded `64k` bitrate caused failures on recordings longer than ~50 minutes — the compressed file still exceeded Whisper's 25 MB API limit. Bitrate is now calculated from audio duration to guarantee output stays under 24 MB, capped between 8–64 kbps. Whisper handles low bitrates well for speech.

Both interview and narration transcription paths are fixed.

Tested

Verified with a 777 MB / ~76 min WAV file that previously failed at upload and now transcribes successfully.

Flask had no MAX_CONTENT_LENGTH set, causing Werkzeug to reject uploads
over 25 MB before they reached the route handler — making the existing
compression logic unreachable dead code.

- Set MAX_CONTENT_LENGTH to 2 GB to accommodate long WAV recordings
- Calculate compression bitrate dynamically based on audio duration so
  the output always fits under Whisper's 25 MB API limit, regardless of
  how long the recording is (previously hardcoded 64k caused failures
  on recordings longer than ~50 minutes)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shaulams shaulams self-requested a review April 11, 2026 09:17
@shaulams shaulams merged commit 5931997 into shaulams:main Apr 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants